<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<h:html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
<h:head />
<h:body>

	<h:form>

		<p:contextMenu for="invoiceTable">
			<p:menuitem value="Edit" icon="ui-icon-search" outcome="/pages/content/invoice/editInvoice.xhtml" />
		</p:contextMenu>

		<p:dataTable id="invoiceTable" var="item" value="#{invoiceController.invoices}" paginator="true" rows="10"
			paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
			rowsPerPageTemplate="5,10,15" selectionMode="single" selection="#{invoiceController.selected}" rowKey="#{item.id}">

			<p:ajax event="contextMenu" listener="#{invoiceController.onRowSelect}" />

			<p:column headerText="Id" sortBy="id"> 						
						#{item.id}
					</p:column>

			<p:column resizable="true" headerText="Code" sortBy="code">
						#{item.code}
					</p:column>

			<p:column headerText="BillingDate" sortBy="billingDate">
				<h:outputText value="#{item.billingDate}">
					<f:convertDateTime pattern="dd.MM.yyyy HH:mm" />
				</h:outputText>

			</p:column>

			<p:column resizable="true" headerText="Pay tax" sortBy="payTax">
						#{item.payTax}
					</p:column>
		</p:dataTable>
	</h:form>

</h:body>
</h:html>
